using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using SecondDemo.API.Services.IService;

namespace SecondDemo.API.Controllers;
[EnableCors("any")]
[ApiController]
[Route("api/[controller]")]
public class TestController : ControllerBase
{
    public IIocService1 IocService1 {get;}
    public IIocService2 IocService2 {get;set;}
    // 创建构造函数 将这些服务传入
    public TestController(IIocService1 iocService1 ,IIocService2 iocService2){
        this.IocService2 = iocService2;
        IocService1 = iocService1;
    }
    // 只要走这个controller中的服务 就会进入上面这些服务的断点
    [HttpGet]
    public string Get()
    {
        return "this is a test api";
    }
}
